<?php
/**
 * Created by PhpStorm.
 * User: YAN
 * Date: 2017/7/14
 * Time: 13:42
 */

namespace App\Components;


class LoginService
{
    private $url = 'http://login.tjise.edu.cn/out/user/applogin';
    public function getUserByCode($username,$psd)
    {
        $post_data = "username=".$username."&pwd=".$psd;
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $this->url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// post数据
        curl_setopt($ch, CURLOPT_POST, true);
// post的变量
        curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);

        $output = curl_exec($ch);
        curl_close($ch);
//        $result = \GuzzleHttp\json_decode($output);
//打印获得的数据
        return $output;
    }
}